#include "EntityManager.h"
#include <iostream>

const int EntityManager::xcy_int = 10;
extern int glob_val;

EntityManager::EntityManager() : class_const_val(10)
{
	std::cout << " EntityManager Construct !!" << std::endl;
}

EntityManager::~EntityManager()
{
	std::cout << " EntityManager Destruct !!" << std::endl;
}

std::vector<Entity*> EntityManager::getEntityList()
{
	return entity_list_;
}

//std::string EntityManager::getClassName()
//{
//	std::cout << " ClassName EntityManager !!" << std::endl;
//	return "EntityManager";
//}


unsigned int EntityManager::GetStaticValue()
{
    static unsigned int a = 1;
    for (int i = 0; i < 10; ++i) {

    }
    return ++a;
}

void EntityManager::AddEntity(Entity* entity)
{
	entity_list_.push_back(entity);
}

void EntityManager::PrintEntityListInfo(std::string str, int a)
{
	for (EntityList::const_iterator itr = entity_list_.begin();
		itr != entity_list_.end(); ++itr)
	{
		std::cout << (*itr)->GetVirtualName() << std::endl;
	}
	std::cout << "current index:" << a << " static: " << GetStaticValue() << "-" << GetFunctionValue() << std::endl
		<< std::endl << std::endl;

	std::cout <<  "static member: " << getStaticValue() << "  :addr" << &xcy_int << std::endl << std::endl;
    //setStaticValue(getStaticValue() + 1);
	std::cout <<  "singleton: " << ++Singleton::getInstance().getValue() << std::endl;
    std::cout <<  "glob_val: " << glob_val << std::endl;
    std::cout <<  "g_static_val: " << g_static_val<< std::endl;
    std::cout <<  "CONST_VAL: " << CONST_VAL << "--" << MyNS::CONST_VAL << "---" << class_const_val <<  std::endl;
	std::cout <<  "global function: " << getTestValueXcy() << std::endl;
}

void EntityManager::PrintEntityListInfoTest(std::string str, int a)
{
	for (EntityList::const_iterator itr = entity_list_.begin(); itr != entity_list_.end(); ++itr)
	{
		std::cout << (*itr)->getTestName() << std::endl;
	}
	std::cout << str << a << std::endl;
}

EntityManager* gEntityMgr = new EntityManager;


int getTestValueXcy()
{
    static int b = 0;
    return ++b;
}
